<?php
/**
 * Created by litong on Date: 2019/2/24 0024 下午 9:28
 */
$host="localhost";$username="root";$password="";$dbname="php_study";
$connection = mysqli_connect($host, $username, $password, $dbname);
if(!$connection){
  echo $connection->connect_error;
}
$sql = "INSERT INTO my_guests (firstname, lastname, email) VALUES ('John', 'Doe', 'john@example.com')";
if(mysqli_query($connection,$sql)){
  echo "执行成功";
}else{
  echo mysqli_error($connection);
}